<template>
  <div class="not-found-container">
    <div class="not-found-content">
      <div class="error-code">404</div>
      <div class="error-message">页面未找到</div>
      <p class="error-description">
        抱歉，您访问的页面不存在或已被删除
      </p>
      <el-button 
        type="primary" 
        class="back-button"
        @click="$router.push('/')"
      >
        返回首页
      </el-button>
    </div>
  </div>
</template>

<script setup lang="ts">
import { onMounted } from 'vue'
import { useUserStore } from '../stores/user'
import { useRouter } from 'vue-router'

const userStore = useUserStore()
const router = useRouter()

onMounted(() => {
  // 如果未登录，3秒后自动跳转到登录页
  if (!userStore.isLoggedIn) {
    setTimeout(() => {
      router.push('/login')
    }, 3000)
  }
})
</script>

<style scoped>
.not-found-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: #f5f7fa;
}

.not-found-content {
  text-align: center;
  padding: 50px;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.error-code {
  font-size: 80px;
  font-weight: bold;
  color: #165DFF;
  margin: 0 0 20px 0;
}

.error-message {
  font-size: 24px;
  color: #1E293B;
  margin: 0 0 10px 0;
}

.error-description {
  color: #64748B;
  margin: 0 0 30px 0;
  max-width: 400px;
}

.back-button {
  padding: 10px 24px;
  font-size: 16px;
}
</style>
